<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <!-- hello comment -->
    <div id="boxDiv">hello div</div>
    <p id="boxP">hello p</p>
    <script>
      const boxDiv = document.getElementById("boxDiv");
      const boxP = document.getElementById("boxP");
      const text = document.body.childNodes[0];
      const comment = document.body.childNodes[1];

      console.log(boxDiv.tagName);
      console.log(boxDiv.nodeName);
      console.log(boxP.tagName); //1
      console.log(boxP.nodeName); //1
      console.log(text.nodeName); // 3
      console.log(comment.nodeName); //8
      console.log(document.nodeName); //9
    </script>
  </body>
</html>
